let { usersModel } = require('./models/usersModel');
//查看我负责的所有客户
module.exports.getUsers = async function (result) {
    return await usersModel.find(result);
}
//修改客户信息
module.exports.updateUsers = async function ({ _id, account, usersPassword, usersName, usersPhone }) {
    return await usersModel.updateOne({ _id }, { account, usersPassword, usersName, usersPhone });
}
//删除客户信息
module.exports.deleteUsers = async function (result) {
    return await usersModel.deleteOne(result);
}
//新增客户
module.exports.addUsers = async function ({ account, usersPassword, usersName, usersPhone, salespersonsId }) {
    return await usersModel.create({ account, usersPassword, usersName, usersPhone, salespersonsId });
}
//查看所属销售员
module.exports.getUsersSubsidiary = async function () {
    return await usersModel.find().populate('salespersonsId');
}